package com.neusoft.demo.server;

import com.neusoft.demo.mapper.CartMapper;
import com.neusoft.demo.pojo.Cart;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

@Service
public class CartServer {
    @Autowired(required = false)
    CartMapper cartMapper;
    public java.util.List<Cart> cartList(){
        return  cartMapper.cartList();
    }
    public  boolean addList(Cart cart){
        int n= cartMapper.addCart(cart);
        if(n>0){
            return  true;
        }else{
            return  false;
        }
    }
    public boolean updateCart(Cart cart){
        int n=cartMapper.updateCart(cart);
        if(n>0){
            return true;
        }else {
            return  false;
        }
    }
    public  boolean delCart(int foodId){
        int n=cartMapper.delCart(foodId);
        if(n>0)
            return  true;
        else
            return false;
    }
    public  boolean del(Cart cart){
        int n=cartMapper.del(cart);
        if(n>0)
            return  true;
        else
            return false;
    }
}
